from fastapi import FastAPI

from xinhou_openai_framework.core.init.AppManager import AppManager


class XinhouWechatSystemApplication:
    def __init__(self):
        self.app = None

    def main(self, args):
        # 创建FastAPI对象
        self.app = AppManager.create_app('test')

        # 添加路由、中间件等配置

        # 启动FastAPI应用
        import uvicorn
        uvicorn.run(
            self.app,
            host="0.0.0.0",
            port=8000,
            loop="asyncio",  # 使用 asyncio 异步框架
            proxy_headers=True  # 启用代理头支持
        )
        print("芯后-OpenAI平台系统模块启动成功！ \n")


if __name__ == "__main__":
    application = XinhouWechatSystemApplication()
    application.main([])
